package com.hxzy.course.mapper;

import com.hxzy.course.pojo.Course;
import com.hxzy.course.pojo.CourseInfo;
import com.hxzy.course.pojo.Staff;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface CourseInfoMapper {

    public List<CourseInfo> conditionQueryTuankeCourseInfo(Map<String,Object> map);

    public List<CourseInfo> conditionQuerySijiaoCourseInfo(Map<String,Object> map);

    public boolean addCourseInfo(Map<String,Map<String,Integer>> map);

    public boolean delCourseInfo(Integer arrange_id);

    @Select("select * from course where co_id=#{id}")
    @Results(id="course",value={
            @Result(id = true,column = "co_id",property = "coId"),
            @Result(column = "co_name",property = "coName"),
            @Result(column = "co_type",property = "coType"),
            @Result(column = "co_maxstu",property = "coMaxstu"),
            @Result(column = "co_price",property = "coPrice"),
            @Result(column = "co_oncetime",property = "coOncetime"),
            @Result(column = "co_image",property = "coImage"),
            @Result(column = "co_describe",property = "coDescribe"),
            @Result(column = "co_describe",property = "coDescribe"),
            @Result(column = "co_flag",property = "coFlag"),
    })
    public Course queryByCourseId(Integer id);

    @Select("select * from staff where staff_id=#{id}")
    public Staff queryByStaffId(Integer id);
}
